<%-- ExMobi JSP文件，注释和取消快捷键统一为Ctrl+/ 多行注释为Ctrl+Shift+/ --%>
<%@ page language="java" import="java.util.*,java.io.*"
 contentType="application/json+xml; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/client/adapt.jsp"%>
<%!  
String savePath ;
private void saveFile(String filepath,String filename) throws Exception{
    FileInputStream is = new FileInputStream(filepath); 
    byte data[] = new byte[is.available()];
    is.read(data); // 读数据
    is.close();
    byte[] reqAttachBody = data;
    FileOutputStream output=new FileOutputStream(savePath+"pictest/"+filename);
    output.write(reqAttachBody);
    output.close();
}
%>
<%
List addrs = aa.req.getAttachAddrs("photfile");
List names = aa.req.getAttachNames("photfile");

//新建存储目录
//获取系统分隔符
String split = System.getProperty("file.separator");
 savePath = (split.equals("/")?"/home/":"c:\\")+"tempfile/";
File f = new File(savePath+"pictest/");
if(!f.exists())
	f.mkdirs();	


for (int i=0;i<addrs.size();i++){
	String fileaddrs = addrs.get(i).toString();
	String filename = names.get(i).toString();
	saveFile(fileaddrs,filename);
	//System.out.println(savePath+"pictest/"+filename);
}

int i=addrs.size();
JSONObject jso = new  JSONObject();
jso.put("count", i);
//System.out.println(jso.toString());
out.print(jso.toString());
%>